  //url截取param
	function getWxParameter(name,paramStr)
    {
    	if(paramStr.length==0)return null;
    	if(paramStr.charAt(0)!='?')return null; 
    	paramStr=paramStr.substring(1);
    	if(paramStr.length==0)return null; 
    	var params=paramStr.split('&');
    	for(var i=0;i<params.length;i++)
    	{
    	var parts=params[i].split('=',2);
	    	if(parts[0]==name)
	    		{
		    		if(parts.length<2||typeof(parts[1])=="undefined"||parts[1]=="undefined"||parts[1]=="null")return "";
			    	return parts[1];
	    		}
	    }
    	return null;
    };
    
    /**
     * 返回替换好的Str字符串
     * @param mstr 需要替换的字符串
     * @param offset 需要替换的下标位置
     * @param count 要替换完结的位置
     * @param chaStr char字符
     * @returns string
     */
    function getReplaceStr(mstr,offset,count,chaStr){
    	var sreplcaStr = null;
    	if(IsEmpty(mstr) || IsEmpty(chaStr) || IsEmpty(offset) || IsEmpty(count)){
    		return null;
    	}
    	if(offset < 0 || count < 0){
    		return null;
    	}
    	
    	if(typeof (offset) != "number" || typeof (count) != "number" || typeof (mstr) != "string" || typeof (chaStr) != "string"){
    		return null;
    	}

    	var mstrlength = mstr.length;
    	if(offset > mstrlength || count > mstrlength){
    		return null;
    	}
    	sreplcaStr = mstr.substring(offset,count);
    	var firstIndex = mstr.indexOf(sreplcaStr);
    	var lastIndex = mstr.lastIndexOf(sreplcaStr);
    	if(firstIndex == lastIndex){
    		return sreplcaStr = mstr.replace(sreplcaStr,chaStr);
    		
    	}else{
    		return	sreplcaStr = mstr.substring(0,offset)+chaStr+mstr.substring(count,mstr.length);
    	}
    }
    
  //特殊url截取param
	function getWxParameterTs(name,paramStr)
    {
    	if(paramStr.length==0)return null;
    	if(paramStr.indexOf('?')<0)return null; 
    	paramStr=paramStr.split('?');
    	paramStr = paramStr[1];
    	if(paramStr.length==0)return null; 
    	var params=paramStr.split('&');
    	for(var i=0;i<params.length;i++)
    	{
    	var parts=params[i].split('=',2);
	    	if(parts[0]==name)
	    		{
		    		if(parts.length<2||typeof(parts[1])=="undefined"||parts[1]=="undefined"||parts[1]=="null")return "";
			    	return parts[1];
	    		}
	    }
    	return null;
    };
    
    //重定向
    function redirectUrl(url){
   	 window.location.href = url;
    }
    
    
    //divtop
    function divTopClick(){
    	$(document).scrollTop(0);
    }
    
    //得到重新排序有索引的对应array
    //headIndex头部索引
    //headReset头部重新排序
    //rst即jsonhead
    //params要html动态的jsonhead
    function getHeadArrayList(headReset,rst,params){
    	var hdIndexL= 0; 
    	if(IsNotEmpty(rst) && IsNotEmpty(params)){
	    	for(var i =0;i<rst.length;i++){
	    		var head = rst[i];
	    		for(var j=0;j <params.length;j++){
	    			var headx = params[j]; 
		    		if(equalsIgnoreCase(head, headx)){
		    			var headset = new Object();
		    			headset.key = i;
		    			headset.head = headx;
		    			headReset[hdIndexL] = headset;
		    			hdIndexL++;
		    			break;
		    		}
	    		} 
	    	}
    	}
    }
    
    
    //返回jsonHead 下标索引
    function getHeadIndex(rstHead,headName){
    	var headIndex = null;
    	for(var i =0;i<rstHead.length;i++){
    		var head = rstHead[i];
	    		if(equalsIgnoreCase(head, headName)){
	    			return headIndex = i;
	    		}
    	}
    	return headIndex;
    }
    
    //返回对应行对应head的值
    function getHeadIndexValue(index,rst,headName){
    	if(IsNotEmpty(rst)){
    		headIndex = getHeadIndex(rst.result.head,headName);
    		if(IsNotEmpty(headIndex)){
    			var length = rst.result.data.length;
    			if(length < index){
    				return null;
    			}else{
    				return rst.result.data[index][headIndex];
    			}
    		}
    	}
    	return null;
    }
    
    //需找是否对应的head
    function isFindDataValue(headReset,index,params){
		for (var c=0;c<headReset.length;c++){
			var headIndex = headReset[c].key;
			var headName = headReset[c].head;
			if(headIndex == index && equalsIgnoreCase(headName, params)){
				return true;
			}
		}
		return false;
    }
    
    //忽略大小写
    function equalsIgnoreCase(str1,str2){
    	if(str1.toUpperCase() == str2.toUpperCase()){
    		return true;
    	}
    	return false;
    }
    
    //判断对象是否为null或空
    function IsEmpty(fData)
    {	
    	var trimStr = null;
    	if((fData==null) || (fData.length==0)){
    		return  true;
    	}
    	if(fData != null){
    		trimStr = jQuery.trim(fData);
    		if(trimStr.length <= 0){
    		return  true;
    		}
    	}
    	return false;
    } 
    
    //判断对象不等于null或空
    function IsNotEmpty(fData){
    	var trimStr = null;
    	if(fData == null ){
    		return  false;
    	}

    	if(fData != null){
    		if(typeof (fData) == "string"){
	    		trimStr = jQuery.trim(fData);
	    		if(trimStr.length > 0){
	    			return true;
	    		}else{
	    			return false;
	    		}
    		}
    		return true;
    	}
    		
    	if ((fData.length > 0)){
    		return  true;
    	}
    	return false;
    	/*return (!(fData==null) ||(fData != null) || (fData.length > 0));*/
    }
    
    //生成parser字符串
    function addToParser(heads,datas,target,parser){
		var obj = new Object();
		obj.head = heads;
		obj.data = datas;
		switch(target){
		case "add":
			if(typeof parser.add == "undefined"){
				parser.add = new Array();
			}
			parser.add.push(obj);
			break;
		case "edit":
			if(typeof parser.edit == "undefined"){
				parser.edit = new Array();
			}
			parser.edit.push(obj);
			break;
		case "del":
			if(typeof parser.del == "undefined"){
				parser.del = new Array();
			}
			parser.del.push(obj);
			break;
		}
		return parser;
    }
    
    function getDetailArray(detailHeads,index){
    	var detailArray = null;
    	if(IsNotEmpty(detailHeads) && IsNotEmpty(index)){
    		detailArray = new Array();
    		for(var i=0;i<detailHeads.length;i++){
    			var id = index + detailHeads[i];
    			detailArray[i] = $("input[id='"+id+"']").val();
    		}
    	}
    	return detailArray;
    }
    
    function getTagStr(tagName,tagJsonHead,data){
    	if(tagName == "img"){
    		return "<div class='weixin_img'><img src='"+data+"'></div>";
    	}
    	return "";
    }
    
    
    function getHtmlString(data){
    	return (data === "null" || data === null ? "": data);
    }
    function getHtmlSomeString(data){
    	return (data === "null" || data === null ? "-": data);
    }
    function getHtmlInt(data){
       	return (data === "null"||data === "" || data === null ? 0 : data);
    }
    
    function _getIntOfJson(i,rst,name){
    	return getHtmlInt(getHeadIndexValue(i, rst, name));
    }
    function _getStringOfJson(i,rst,name){
    	return getHtmlString(getHeadIndexValue(i, rst, name));
    }
    function _getSomeOfJson(i,rst,name){
    	return getHtmlSomeString(getHeadIndexValue(i, rst, name));
    }
    function getIdByName(name){
    	var paramStr=location.search;
    	return getWxParameter(name,paramStr);    	
    }
    
    function checkMoney(data){
    	var reg=/^([1-9][\d]{0,7}|0)(\.[\d]{1,2})?$/;
    	return reg.test(data);
    }
    function alertErrorMessage(message){
		art.dialog({fixed:true, lock: true,content:message,icon:'error',ok:true});	
    }
    function alertSucceedMessage(message){
		art.dialog({fixed:true, lock: true,content:message,icon:'succeed',ok:true});	
    }

    function alertWaringMessage(message){
		art.dialog({fixed:true, lock: true,content:message,icon:'waring',ok:true});	
    }
    function getInputValue(inputId){
    	var value = $("#"+inputId).val();
    	return IsEmpty(value)?null:value.replace(/\s/gi,'');
    }
    
    
    function getHtmlValue(Id){
    	var value = $("#"+Id).html();
    	return IsEmpty(value)?null:value.replace(/\s/gi,'');
    }
    
    function getToday() {
		var date = new Date();
		var y = date.getFullYear();
		var m = date.getMonth();
		m = parseInt(m) + 1;
		m = m >= 10 ? m : '0' + m;
		var d = date.getDate();
		d = d >= 10 ? d : '0' + d;
		return y + '-' + m + '-' + d;
	}
    
    //计算日期差
    function getDateDiff(startDate,endDate){
        var arr1=startDate.split('-');
    	var arr2=endDate.split('-');
    	var d1=new Date(arr1[0],arr1[1],arr1[2]);
    	var d2=new Date(arr2[0],arr2[1],arr2[2]);
    	var day = (d2.getTime()-d1.getTime())/(1000*3600*24);
    	return day;
    }

